<?php 
//test mysql
mysql_connect("10.10.7.14", "root", "") or die(mysql_error()); 
echo "Connected to MySQL<br />"; 
exit();
?>





<?php


	$hostname = 'localhost:C:\\Ibssdemo.gdb';
	$username = 'SYSDBA';
	$password = 'masterkey';
	//ibase_connect($hostname, $username, $password);
	$res = ibase_connect($hostname,$username,$password) or die("<br>" . ibase_errmsg());
	
	// QUERY FOR ALL DB TABLE
	//$sql='SELECT RDB$RELATION_NAME as TBLNAME FROM RDB$RELATIONS WHERE RDB$SYSTEM_FLAG=0;';
	// QUERY FOR GETTING CARD EVENTS/PUNCHES
	$sql="SELECT * FROM EVENT WHERE EVENTDATE > '2012-07-01' AND CARDID = '001A3148' ORDER BY EVENTDATE";
	$result=ibase_query($res,$sql) or die(ibase_errmsg());
	
	echo '<table border="1">';
	echo '<tr><td>EVENTID</td><td>EVENTDATE</td><td>SUBSYSTEMID</td><td>WORKSTATIONID</td><td>COMMCHANNELID</td><td>CONTROLLERID</td><td>DEVICEID</td><td>EVENTTYPE</td>
	<td>EVENTMSG</td><td>DATASTRING</td><td>CARDID</td></tr>';
	while($row=ibase_fetch_object($result)){
		//print $row->TBLNAME.'<br />';
		echo '<tr>';
		echo '<tr><td>'.$row->EVENTID.'</td><td>'.$row->EVENTDATE.'</td><td>'.$row->SUBSYSTEMID.'</td><td>'.$row->WORKSTATIONID.'</td><td>'.$row->COMMCHANNELID.'</td><td>'.$row->CONTROLLERID.'</td>
		<td>'.$row->DEVICEID.'</td><td>'.$row->EVENTTYPE.'</td><td>'.$row->EVENTMSG.'</td><td>'.$row->DATASTRING.'</td><td>'.$row->CARDID.'</td></tr>';
		echo '</tr>';
	}
	echo '</table>';
	
	
	
	
	
	// //get cardholders
	// $sql="SELECT * FROM CARDHOLDER";
	// $result=ibase_query($res,$sql) or die(ibase_errmsg());
	
	// // echo '<table border="1">';
	// // echo '<tr><td>EVENTID</td><td>EVENTDATE</td><td>SUBSYSTEMID</td><td>WORKSTATIONID</td><td>COMMCHANNELID</td><td>CONTROLLERID</td><td>DEVICEID</td><td>EVENTTYPE</td>
	// // <td>EVENTMSG</td><td>DATASTRING</td><td>CARDID</td></tr>';
	// while($row=ibase_fetch_object($result)){
		// print_r($row);
		// // echo '<tr>';
		// // echo '<tr><td>'.$row->EVENTID.'</td><td>'.$row->EVENTDATE.'</td><td>'.$row->SUBSYSTEMID.'</td><td>'.$row->WORKSTATIONID.'</td><td>'.$row->COMMCHANNELID.'</td><td>'.$row->CONTROLLERID.'</td>
		// // <td>'.$row->DEVICEID.'</td><td>'.$row->EVENTTYPE.'</td><td>'.$row->EVENTMSG.'</td><td>'.$row->DATASTRING.'</td><td>'.$row->CARDID.'</td></tr>';
		// // echo '</tr>';
	// }
	// //echo '</table>';
	
	
	
	
	
	
	
	
	ibase_free_result($result);

	// Closing
	ibase_close($res) or die("<br>" . ibase_errmsg());
?>